﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RR75Request", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR75Request))]
    public class RR75RequestSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRR75Request clazz;
        
        public RR75RequestSerializer(IRR75Request clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("picIsikukood");
            if (clazz.PicIsikukood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PicIsikukood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PicIsikukood");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="picIsikukood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR75Request>picIsikukood");
                }
                clazz.PicIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("picIsikukood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR75Request>picIsikukood", Reader.LocalName);
            }
        }
    }
}
